package com.foreverwin.mes.meapi.service.impl;

import com.foreverwin.mes.core.base.FrontPage;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.foreverwin.mes.meapi.model.Sfc;
import com.foreverwin.mes.meapi.model.SfcInWork;
import com.foreverwin.mes.meapi.mapper.SfcInWorkMapper;
import com.foreverwin.mes.meapi.service.SfcInWorkService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Ervin Chen
 * @since 2020-02-07
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SfcInWorkServiceImpl extends ServiceImpl<SfcInWorkMapper, SfcInWork> implements SfcInWorkService {


    @Autowired
    private SfcInWorkMapper sfcInWorkMapper;

    @Override
    public Page<SfcInWork> selectPage(FrontPage<SfcInWork> frontPage, SfcInWork sfcInWork) {
        EntityWrapper<SfcInWork> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(sfcInWork);
        return super.selectPage(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<SfcInWork> selectList(SfcInWork sfcInWork) {
        EntityWrapper<SfcInWork> queryWrapper = new EntityWrapper<>();
        queryWrapper.setEntity(sfcInWork);
        return super.selectList(queryWrapper);
    }

    @Override
    public List<Sfc> selectSfc(String resourceBo) {
        return sfcInWorkMapper.selectSfc( resourceBo );
    }
}